﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AudioPlayer.Plugin.Storage {
	/// <summary>
	/// Information storage interface.
	/// </summary>
	public interface IStorage : IPlugin {

		/// <summary>
		/// Opens connection, if needed
		/// </summary>
		void Open();
		/// <summary>
		/// Closes the connection.
		/// </summary>
		void Close();

		/// <summary>
		/// Reads all songs, and adds to main playlist
		/// </summary>
		void Read();

		/// <summary>
		/// Loads the specified playlists.
		/// </summary>
		/// <param name="pl">The playlist.</param>
		void Load(IPlaylist pl);
		/// <summary>
		/// Pus the songs to specific playlist.
		/// </summary>
		/// <param name="list">The list.</param>
		void Put(IPlaylist playlist,params ISong[] songs);

		/// <summary>
		/// Puts the playlist to playlist collection.
		/// Saves to storage device.
		/// </summary>
		/// <param name="list">The list.</param>
		void Put(IPlaylist playlist);

		/// <summary>
		/// Updates the song.
		/// </summary>
		/// <param name="song">The song.</param>
		void Update(ISong song);

		/// <summary>
		/// Updates the playlist.
		/// </summary>
		/// <param name="playlist">The playlist.</param>
		void Update(IPlaylist playlist);

		/// <summary>
		/// Deletes the specified playlist.
		/// </summary>
		/// <param name="playlist">The playlist.</param>
		void Delete(IPlaylist playlist);

		/// <summary>
		/// Playlists
		/// </summary>
		IList<IPlaylist> Playlists { get;}

		/// <summary>
		/// Library playlist
		/// </summary>
		IPlaylist Library { get;}


		/// <summary>
		/// Gets a value indicating whether this <see cref="IStorage"/> is valid.
		/// </summary>
		/// <value><c>true</c> if valid; otherwise, <c>false</c>.</value>
		bool Valid { get; }

		/// <summary>
		/// Occurs when storage fills main playlist
		/// </summary>
		event EventHandler OnUpdate;
	}
}
